package com.example.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class SendMessageController {
    @Autowired
    private Source source;
    @GetMapping("/send")
    public Object send(@RequestParam String message){
        source.output().send(MessageBuilder.withPayload(message).build());
        return "message send:"+message;
    }
}
